import Foundation

final class UserPreferences {
    private let defaults: UserDefaults
    private enum Keys {
        static let isOnboarded = "user.isOnboarded"
        static let lastSelectedTabIndex = "ui.lastSelectedTabIndex"
    }

    init(defaults: UserDefaults = .standard) {
        self.defaults = defaults
    }

    var isOnboarded: Bool {
        get { defaults.bool(forKey: Keys.isOnboarded) }
        set { defaults.set(newValue, forKey: Keys.isOnboarded) }
    }

    var lastSelectedTabIndex: Int {
        get { defaults.integer(forKey: Keys.lastSelectedTabIndex) }
        set { defaults.set(newValue, forKey: Keys.lastSelectedTabIndex) }
    }
}


